<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@include file="/pageRc/common/common.jsp"%>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport"
	content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="msapplication-tap-highlight" content="no">

<link rel="stylesheet" href="<%=commonPath%>/pageRc/layui/css/layui.css"
	media="all">
<link rel="stylesheet" href="<%=commonPath %>/res/css/global.css"> 
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/common/utils.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/common/msgTool.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/layui/layui.js"></script>

<title>报工审核</title>

<script>
	/* $(function(){

 	})
	//注意：选项卡 依赖 element 模块，否则无法进行工能性操作
	layui.use('element', function() {
		var element = layui.element();

		//…
	}); */
 
</script>
</head>
<body>
<div class="header">
  <blockquote class="layui-elem-quote">报工审核</blockquote>
 </div>
 <form id="createMsgForm" name="createMsgForm" class="layui-form"
			action="">
			<input type="hidden" class="layui-input" value="${proTeamNo}" id="proTeamNo" />
			<input type="hidden" class="layui-input" value="${rouid}" id="rouid" />
			<div class="layui-form-item">
				<div class="layui-inline">
					<div class="layui-inline">
					填报时间：
					</div>
					<div class="layui-inline">
						<input class="layui-input" style="width: 210" id="happenDate"
							value="${happenDate}"
							onclick="layui.laydate({elem: this, istime: true, format: 'YYYYMMDD'})"
							placeholder="填报时间">
					</div>
					<div class="layui-inline">
						<button class="layui-btn" type="button" id="doSearchSum" onClick="search()" >查询</button>
					</div>
				</div>
			</div>
		</form>
 <div style="layui-main"> 
           　 <ul class="fly-list fly-list-top">  
		           <c:forEach items="${list}" var="job" > 
		     			<li class="fly-list-li" style="padding-left: 5px;padding-right: 5px;">
			              <button class="layui-btn layui-btn-small" style="margin-left: 5px;margin-right: 5px;" onClick="confirmJob('${job.rouid}', '01')" >√</button>
			              <button class="layui-btn layui-btn-small" style="margin-left: 0px;margin-right: 5px;" onClick="confirmJob('${job.rouid}', '02')" >×</button>
			             <%--  <h2 class="fly-tip"> 
			              <span> 备注:${job.remark}</span>
			              </h2> --%>
				           <p> 
				            <span>${job.userName}/${job.happenDate}&nbsp;&nbsp;&nbsp;&nbsp;${job.needUseTime}/${job.stage}</span>
				            </p>
				          <p>
				            <span>${job.needNo}/${job.needName}</span>
				            <c:if test="${job.reportState == '00'}">
				            	<span style="color: red;">未审核</span>
				            </c:if>
				            <c:if test="${job.reportState == '01'}">
				            	<span>审核通过</span>
				            </c:if>
				            <c:if test="${job.reportState == '02'}">
				            	<span style="color: red;">审核未通过</span>
				            </c:if>
				          </p>
			          </li>
		 	       </c:forEach> 
		    　　 </ul>  
</div>
</body>
<script type="text/javascript">
var path="<%=commonPath%>";
	var msg = new msgTool();
	layui.use([ 'form', 'layer', 'laytpl', 'laypage', 'laydate' ],
			function(){
		layer = layui.layer;
	});

function search(){
	var happenDate = $("#happenDate").val();
	var	proTeamNo = $("#proTeamNo").val();
	var	rouid = $("#rouid").val();
	if(happenDate == "" || happenDate == null){
		href = "<%=commonPath %>/page/job/"+proTeamNo+"/"+rouid+"/searchReviewJob.do";
	}else{
		href = "<%=commonPath %>/page/job/"+happenDate+"/"+proTeamNo+"/"+rouid+"/searchReviewJob.do";
	}
	location.href =href;
}
function confirmJob(rouid, sign) {
 var jsonDate = {};
       jsonDate.rouid = rouid;
       jsonDate.reportState = sign;
       var index = parent.layer.getFrameIndex(window.name); //获取当前窗体索引
       var message = "";
       if(sign == '01'){
       	message = "确认审核通过?";
       }else if(sign == '02'){
       	message = "确认审核不通过?";
       }
       layer.confirm(message, {icon:3,title:"提示"},function(index){
			msg.sendMsg("/page/job/confirmJob.do",jsonDate,function(data){
				var rsObj = null;
				var href = "";
				var	proTeamNo = $("#proTeamNo").val();
				var	rouid = $("#rouid").val();
				var happenDate = $("#happenDate").val();
				if(happenDate == "" || happenDate == null){
					href = "<%=commonPath %>/page/job/"+proTeamNo+"/"+rouid+"/searchReviewJob.do";
				}else{
					href = "<%=commonPath %>/page/job/"+happenDate+"/"+proTeamNo+"/"+rouid+"/searchReviewJob.do";
				}
	            if (msg.isJson(data)) {
	                rsObj = data
	            } else {
	                rsObj = JSON.parse(data);
	            }
	           
	            var retCode = rsObj.head.retCode;
	            if (retCode !== '0000') {
	                layer.alert("操作失败！");
	            } else {
	            	 layer.alert("操作成功！");
	                location.href =href;
	           }
			});
	   }); 
}
	 
	 
</script>

</html>